<template>
  <swiper class="detail-swiper">
    <swiper-item v-for="(item, index) in topImages" :key="'topImages' + index">
      <img v-lazy="item" alt />
    </swiper-item>
  </swiper>
</template>

<script>
// 导入轮播图组件使用
import { Swiper, SwiperItem } from "components/common/swiper";

export default {
  name: "DetailSwiper",
  // 组件注册
  components: {
    Swiper,
    SwiperItem,
  },
  // 接收父组件传递数据
  props: {
    topImages: {
      type: Array,
      // 数组默认值必须是一个函数 内部返回一个空数组
      default() {
        return [];
      },
    },
  },
};
</script>

<style lang="less" scoped>
.detail-swiper {
  height: 300px;
  overflow: hidden;
}
</style>